<template>
	<view class="box">
		<!-- <view class="hidden" style="padding: 0 40rpx;" v-if="type_name === 'ydxz'">
			<view class="font_38 text_bold detail_m10" v-if="!is_str">预定须知</view>
			<view class="font_27 detail_m11" v-if="is_str">{{content}}</view>
			<view class="font_27 flex1 detail_m11" v-for="item in content" :key="item.title" v-else>
				<view class="text_bold detail_m12">{{item.title}}</view>
				<view class="color_7b w_flex1">{{item.intro}}</view>
			</view>
		</view> -->
		<view v-html="content"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type_name: '',
				content: '',
				is_str: false,
        tuikCon:'退订规则<br>1.存入日期的00:00点前，可退全款。<br>2．取件日期的24:00后，默认订单已使用，将无法取消与退款。<br>3．订单一经使用，将无法取消与退款。<br>4.做过变更的订单，将无法取消与退款。<br>5.退款已撤销的订单，将无法进行二次取消与退款。<br><br>退订流程<br>1．用户自主发起退款申请。<br>2.平台将在24小时内进行退款审核，如遇节假日则自动顺延。<br>3.退款审核通过的订单，退款金额将在审核通过后退回原支付账户。'
			}
		},
		onLoad(e) {
			this.type_name = e.type;
      console.log('e.type=======》',e.type)
			if (e.type === 'jcxz') {
				// 寄存须知
				this.getConsign();
			}

			if (e.type === 'jczn') {
				// 寄存指南
				this.getGuide();
			}

			if (e.type === 'yhxy') {
				// 用户协议
				this.getAgreement();
			}else if(e.type === 'tdgz'){
        this.$http.get(this.$api.refundReasonContentApi,{}).then(res=>{
          this.content = res.data.content
        });
        // this.content = this.tuikCon;
        uni.setNavigationBarTitle({
          title:'退订规则'
        })
      }else if(e.type === 'ysxy'){
        this.$http.get(this.$api.getPolicyApi, {
        	port: 1
        }).then(res=>{
          console.log('隐私', res, res.data)
          if(res.code == 200){
            this.content = res.data[0].content_text
          }
          
        })
        uni.setNavigationBarTitle({
          title:'隐私协议'
        })
      }

			if (e.content) {
				this.type_name = 'ydxz'
				// 预定须知

				// let fist_ = e.content.substr(0, 1);

				// if (fist_ === "[") {
				// 	this.is_str = false;
				// 	this.content = JSON.parse(e.content);
				// } else {
				// 	this.is_str = true;
				// 	this.content = e.content;
				// }
				this.content = uni.getStorageSync('ydxz');
			}
		},
		methods: {
			getConsign() {
				this.$http.get(this.$api.getConsign, {
					port: 1
				}).then(res => {
					if (res.data) {
						this.content = res.data.content_text.replace(/<img/g, '<img class="fwb_img"');
					}
				})
			},
			getGuide() {
				this.$http.get(this.$api.getGuide, {
					port: 1
				}).then(res => {
					if (res.data) {
						this.content = res.data.content_text.replace(/<img/g, '<img class="fwb_img"');
					}
				})
			},
			getAgreement() {
				this.$http.get(this.$api.getAgreement).then(res => {
					if (res.data) {
						this.content = res.data.content_text.replace(/<img/g, '<img class="fwb_img"');
					}
				})
			}
		}
	}
</script>

<style lang="less">
	.detail_m10 {
		text-align: center;
		margin: 37rpx 0;
	}

	.detail_m11 {
		margin: 0 0 31rpx 0;

		&:last-child {
			margin-bottom: 98rpx;
		}
	}
	.box{
		padding: 10px; box-sizing: border-box;
	}
	.detail_m12 {
		margin: 0 23rpx 0 0;
	}
</style>
